package com.vdf.sisconsolid.validator;

import java.util.ArrayList;
import java.util.List;

import com.vdf.sisconsolid.persistencemodule.dto.TracingDTO;
import com.vdf.sisconsolid.rest.requestresponsedata.ValidatedField;
import com.vdf.sisconsolid.util.UtilSC;

public class TracingValidator extends Validator {

	public static List<ValidatedField> valid(TracingDTO tracing) {
		List<ValidatedField> validatedFieldList = new ArrayList<ValidatedField>();
		if (tracing.getDateAccomplished() == null) {
			createValidateField("dateAccomplished", "missingDateAccomplished",
					validatedFieldList);
		}
		if ((tracing.getIdTracingType().equals(1L) || tracing
				.getIdTracingType().equals(3L))
				&& UtilSC.isEmptyString(tracing.getTimeAccomplished())) {
			createValidateField("timeAccomplished", "missingTimeAccomplished",
					validatedFieldList);
		}
		if (UtilSC.isEmptyString(tracing.getNeed())) {
			createValidateField("need", "missingNeed", validatedFieldList);
		}
		if (UtilSC.isEmptyString(tracing.getResult())) {
			createValidateField("result", "missingResult", validatedFieldList);
		}
		return validatedFieldList;
	}

}
